import actions from "./actions.js"
import mutations from './mutations.js'

let state = {
	loginStatus: false,
	token: false,
	user: {},
	userInfo: {},
	chat: null,
}

let getters = {
	userId(state) {
		return state.userInfo.id || null;
	}
}

// #ifndef VUE3
import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
	state,
	getters,
	mutations,
	actions
})
// #endif

// #ifdef VUE3
import { createStore } from 'vuex'
const store = createStore({
	state,
	getters,
	mutations,
	actions
})
// #endif

export default store